From d79d5945e3275ac0a0d63c185790ac41a51eda87 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 20 Oct 2014 20:14:00 +0200 Subject: InfoDump: Do not crash if one plugin fails to load. If there's a syntax error in one plugin's Info.lua file, report the error and continue processing. --- MCServer/Plugins/InfoDump.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MCServer/Plugins/InfoDump.lua b/MCServer/Plugins/InfoDump.lua index bc9bab767..de1d1f451 100644 --- a/MCServer/Plugins/InfoDump.lua +++ b/MCServer/Plugins/InfoDump.lua @@ -625,7 +625,11 @@ local function LoadPluginInfo(a_FolderName) -- This is Lua-5.1-specific and won't work in Lua 5.2! local Sandbox = {} setfenv(cfg, Sandbox) - cfg() + local isSuccess, errMsg = pcall(cfg) + if not(isSuccess) then + return nil, "Cannot load Info.lua: " .. (errMsg or "") + end + if (Sandbox.g_PluginInfo == nil) then return nil, "Info.lua doesn't contain the g_PluginInfo declaration" end -- cgit v1.2.3